<% var cssExt = [ 
	"/plugins/jquery.bsgrid/builds/merged/bsgrid.all.min.css"
	]; %>
	
<%layout("/template/admin/common/_layout.html", {title: '资讯列表', cssExt: cssExt}){ %>

<nav class="breadcrumb"><a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form id="searchForm">
	<div class="text-c"> 查找：
		<input type="text" class="input-text" style="width:250px" placeholder="输入内容" name="key">
		<button type="button" class="btn btn-success radius" onclick="doSearch()"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
	</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
	    <a href="javascript:;" onclick="checkDelete()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
       <!-- <a href="javascript:void(0)" onClik="delCurrentRow(this);" class="btn btn-danger radius" ><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>-->  
		<a href="${ctxPath}/information/add" class="btn btn-primary radius">
		<i class="Hui-iconfont">&#xe600;</i>添加</a></span>
	</div>
	<div class="mt-20">
	<table id="infoTable" class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
        		<th scope="col" colspan="12">资讯列表</th>
      		</tr>
			<tr class="text-c">
				<th w_check="true" w_index="INFORMATION_ID" width="3%;"></th>
				<th w_index="INFORMATION_ID" w_sort="INFORMATION_ID" width="60">ID</th>
				<th w_index="INFORMATIONTITLE" w_sort="INFORMATIONTITLE" width="">标题</th>
				<th w_index="INFORMATIONSUBTITLE" w_sort="INFORMATIONSUBTITLE" width="">副标题</th>
				<th w_index="INFORMATIONISSUETIME" w_sort="INFORMATIONISSUETIME" width="">INFORMATIONISSUETIME</th>
				<th w_index="INFORMATIONMODIFYTIME" w_sort="INFORMATIONMODIFYTIME" width="">INFORMATIONMODIFYTIME</th>
				<th w_index="INFORMATIONVERSION" w_sort="INFORMATIONVERSION" width="">版本</th>
				<th w_index="inforModifyMen" w_sort="inforModifyMen" width="">修改人</th>
				<th w_render="operate" width="10%;">操作</th>
			</tr>			
		</thead>
	</table>
	<!-- <input type="button" value="删除">-->
	</div>
</div>

<script type="text/javascript" src="${ctxPath}/static/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="${ctxPath}/plugins/jquery.bsgrid/builds/js/lang/grid.zh-CN.min.js"></script>
<script type="text/javascript" src="${ctxPath}/plugins/jquery.bsgrid/builds/merged/bsgrid.all.min.js"></script>
<!--  <script language=javascript>-->


<script type="text/javascript">
var gridObj; //全局变量
/*初始化表格*/
	$.bsgridLanguage.noDataToDisplay = '<font>没有数据</font>'; // can set a html code paragraph	
    gridObj = $.fn.bsgrid.init('infoTable', {
        url: '${ctxPath}/information/table',
       	//pageSizeSelect: true,
       	autoLoad: false,
        pageSize: ${pageSize!10},
        displayBlankRows: false, // single grid setting
        rowHoverColor: true
    });
    gridObj.page(${pageIndex!1});
/*批量删除 *
 * 
 */
function del(id){
	 layer.confirm( '确定要删除吗 ?',{icon:3},function(index){
	    	$.ajax({
	    	type:"POST",
//	    	data:{ids:ids},
	    	url:"${ctxPath}/information/checkDelete",
	    	success:function(data){
	    		if(data){
	    			layer.alert('删除成功 !',{icon:1},function(index){
	    				gridObj.refreshPage();
	    				layer.close(index);
	    			});
	    		}else{
	    			layer.alert('删除失败! ',{icon:2},function(){
	    				gridObj.refreshPage();
	    				layer.close(index);
	    			});
	    		}
	    	},
	    	error:function(b){
	    		console.info('请求出错 !');
	    	}
	    	});
	    	});
	 console.info(id);
	    }
 
     function checkDelete(){
    	 var ids=gridObj.getCheckedValues('INFORMATION_ID');
 //   	 console.infomation(ids);INFORMATION_ID
    	if(ids.length==0){
    		layer.alert('请选择一个条目!',{icon:0});
    		return;
     }
    layer.confirm( '确定要删除吗 ?',{icon:3},function(index){
    	$.ajax({
    	type:"POST",
    	data:{ids:ids.toString()},
    	url:"${ctxPath}/information/checkDelete",
    	success:function(data){
    		if(data){
    			layer.alert('删除成功 !',{icon:1},function(index){
    				gridObj.refreshPage();
    				layer.close(index);
    			});
    		}else{
    			layer.alert('删除失败! ',{icon:2},function(){
    				gridObj.refreshPage();
    				layer.close(index);
    			});
    		}
    	},
    	error:function(d){
    		console.info('请求出错 !');
    	}
    	});
    	});
    }
    /*操作*
     * 
     */
    function operate(record, rowIndex, colIndex, options){
    	var id = gridObj.getRecordIndexValue(record, 'INFORMATION_ID');
		var dl='<a href="javascript:;" class="btn btn-danger-outline radius" onclick="del(\''+ id + '\');">删除</a>'
		return '<a href="${ctxPath}/information/edit/' + id + '" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe60c;</i>编辑</a>'+dl;
//		var del='<a href="javascript:;" class="btn btn-danger-outline radius" onclick="del(\''+ id + '\');">删除</a>'
    }
    
/*搜索*/
function doSearch() {
	var searchParames = $('#searchForm').serializeArray(); // jQuery推荐方式
	gridObj.search(searchParames);
}
</script>
<% } %>
